<?php
/**
 * 不继承Command 用于业务逻辑发送任务时继承
 * Created by PhpStorm.
 * User: yi
 * Date: 2017/2/15
 * Time: 14:26
 */

namespace app\console\common;

class ClientCommand {
    protected $isLog = true;//是否写log，生产环境请设为false

    public function sendData($data) {
        $client = new \swoole_client(SWOOLE_SOCK_TCP);
        $client->connect('127.0.0.1', 9800, 1);

        //失败返回false，成功返回发送数据长度
        return $client->send($data . PHP_EOL);
    }

}